//
//  OMTSDKDataCache.m
//  Pods
//
//  Created by yizhaorong on 2017/3/20.
//
//

#import "OMTDataCache.h"

@implementation OMTDataCache

+ (instancetype)sharedInstance {
    static OMTDataCache *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [OMTDataCache new];
    });
    return instance;
}

- (instancetype)init {
    if (self = [super init]) {
        self.memCache.name = @"com.onemt.data";
    }
    return self;
}

- (void)storeData:(id)data key:(NSString *)key {
    if (!data || !key) {
        return;
    }
    
    [self.memCache setObject:data forKey:key];
}

- (id)dataForKey:(NSString *)key {
    return [self.memCache objectForKey:key];
}

@end
